/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JIFInventario.java
 *
 * Created on 02-nov-2011, 17:21:11
 */
package jam.sfcc.application;

import jam.sfcc.business.CategoriaBusiness;
import jam.sfcc.business.ProductoBusiness;
import jam.sfcc.common.domain.Administrador;
import jam.sfcc.common.domain.Categoria;
import jam.sfcc.common.domain.Producto;
import java.sql.SQLException;
import java.util.LinkedList;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Josué
 */
public class JIFInventario extends javax.swing.JInternalFrame {

    private Administrador administrador;
    private LinkedList<Categoria> categorias;

    /** Creates new form JIFInventario */
    public JIFInventario(Administrador administrador) {
        initComponents();
        this.administrador = administrador;
        CategoriaBusiness categoriaBusiness = new CategoriaBusiness(administrador.getNombre(), administrador.getClave());

        try {
            categorias = categoriaBusiness.getCategorias();

            for (Categoria categoria : categorias) {
                cbCategoriaN.addItem(categoria);
                cbCategoriasB.addItem(categoria);
                jCCategoriasI.addItem(categoria);
                jCCategoriasA.addItem(categoria);
                jCCategoriasActualizar.addItem(categoria);
            }
        } catch (SQLException ex) {
            ex.printStackTrace();
        }

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        panelEncabezados4 = new jam.sfcc.application.PanelEncabezados();
        jLabel28 = new javax.swing.JLabel();
        lblProducto = new javax.swing.JLabel();
        tfNombreProducto = new javax.swing.JTextField();
        cbCategoriasB = new javax.swing.JComboBox();
        bBuscar = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTTablaProductos = new javax.swing.JTable();
        jPanel2 = new javax.swing.JPanel();
        panelEncabezados5 = new jam.sfcc.application.PanelEncabezados();
        jLabel29 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        tfNombreProductoN = new javax.swing.JTextField();
        tfCantidadProductoN = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        cbCategoriaN = new javax.swing.JComboBox();
        jLabel6 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        taDescripcionProductoN = new javax.swing.JTextArea();
        btnRegistrar = new javax.swing.JButton();
        tfPrecioProductoN = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        tfPuntoReordenProductoN1 = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        panelEncabezados8 = new jam.sfcc.application.PanelEncabezados();
        jLabel32 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jBProductosPtoReorden = new javax.swing.JButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTablaProductoPtoReorden = new javax.swing.JTable();
        jPanel3 = new javax.swing.JPanel();
        panelEncabezados6 = new jam.sfcc.application.PanelEncabezados();
        jLabel30 = new javax.swing.JLabel();
        jlProductoInventario = new javax.swing.JLabel();
        jTProductoInventario = new javax.swing.JTextField();
        jCCategoriasI = new javax.swing.JComboBox();
        jBAceptarAE = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLCodigoI = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jTDescripcionI = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jTCantidadI = new javax.swing.JTextField();
        jPanel6 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        jTPrecioI = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jTCategoriaI = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jTUnidadesParaAgregar = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jBActualizarExistencias = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        panelEncabezados7 = new jam.sfcc.application.PanelEncabezados();
        jLabel31 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jTProductoA = new javax.swing.JTextField();
        jCCategoriasA = new javax.swing.JComboBox();
        jBBuscarA = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jBActualizarInformacion = new javax.swing.JButton();
        jTCodigoA = new javax.swing.JTextField();
        jTDescripcionA = new javax.swing.JTextField();
        jTCantidadA = new javax.swing.JTextField();
        jTPrecioA = new javax.swing.JTextField();
        jCCategoriasActualizar = new javax.swing.JComboBox();
        jLabel19 = new javax.swing.JLabel();
        jTNombreProductoActualizar = new javax.swing.JTextField();

        setClosable(true);
        setIconifiable(true);
        setTitle("Inventario");

        jTabbedPane1.setBackground(new java.awt.Color(204, 204, 204));
        jTabbedPane1.setForeground(new java.awt.Color(255, 255, 255));
        jTabbedPane1.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
        jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.LEFT);
        jTabbedPane1.setDoubleBuffered(true);
        jTabbedPane1.setFont(new java.awt.Font("Century Gothic", 0, 16));
        jTabbedPane1.setPreferredSize(new java.awt.Dimension(597, 447));

        jLabel28.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel28.setText("Buscar Productos");

        lblProducto.setText("Producto:");

        bBuscar.setText("Buscar");
        bBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bBuscarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelEncabezados4Layout = new javax.swing.GroupLayout(panelEncabezados4);
        panelEncabezados4.setLayout(panelEncabezados4Layout);
        panelEncabezados4Layout.setHorizontalGroup(
            panelEncabezados4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelEncabezados4Layout.createSequentialGroup()
                .addContainerGap(123, Short.MAX_VALUE)
                .addComponent(jLabel28)
                .addGap(191, 191, 191))
            .addGroup(panelEncabezados4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblProducto)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(tfNombreProducto, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cbCategoriasB, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(bBuscar)
                .addContainerGap(83, Short.MAX_VALUE))
        );
        panelEncabezados4Layout.setVerticalGroup(
            panelEncabezados4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelEncabezados4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel28)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelEncabezados4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblProducto)
                    .addComponent(tfNombreProducto, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbCategoriasB, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE)
                    .addComponent(bBuscar))
                .addContainerGap())
        );

        jTTablaProductos.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jTTablaProductos.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null}
            },
            new String [] {
                "Código", "Nombre", "Descripción"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane2.setViewportView(jTTablaProductos);
        jTTablaProductos.getColumnModel().getColumn(0).setResizable(false);
        jTTablaProductos.getColumnModel().getColumn(2).setResizable(false);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelEncabezados4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(panelEncabezados4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(109, 109, 109))
        );

        jTabbedPane1.addTab("Buscar Productos", jPanel1);

        jLabel29.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel29.setText("Agregar Nuevo Producto");

        javax.swing.GroupLayout panelEncabezados5Layout = new javax.swing.GroupLayout(panelEncabezados5);
        panelEncabezados5.setLayout(panelEncabezados5Layout);
        panelEncabezados5Layout.setHorizontalGroup(
            panelEncabezados5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelEncabezados5Layout.createSequentialGroup()
                .addContainerGap(157, Short.MAX_VALUE)
                .addComponent(jLabel29)
                .addGap(88, 88, 88))
        );
        panelEncabezados5Layout.setVerticalGroup(
            panelEncabezados5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelEncabezados5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel29)
                .addContainerGap(50, Short.MAX_VALUE))
        );

        jLabel3.setText("Nombre:");

        jLabel4.setText("Cantidad:");

        jLabel9.setText("Categoría:");

        jLabel6.setText("Descripción:");

        taDescripcionProductoN.setColumns(20);
        taDescripcionProductoN.setRows(5);
        jScrollPane1.setViewportView(taDescripcionProductoN);

        btnRegistrar.setText("Registrar");
        btnRegistrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRegistrarActionPerformed(evt);
            }
        });

        jLabel5.setText("Precio:");

        jLabel7.setText("Punto de Reorden:");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelEncabezados5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tfNombreProductoN, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(36, 36, 36))
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                        .addGap(146, 146, 146)
                        .addComponent(btnRegistrar))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel7)
                            .addComponent(jLabel4)
                            .addComponent(jLabel9)
                            .addComponent(jLabel5))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cbCategoriaN, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfPrecioProductoN, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfCantidadProductoN, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfPuntoReordenProductoN1, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(234, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(panelEncabezados5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfNombreProductoN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addGap(9, 9, 9)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(tfCantidadProductoN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(tfPuntoReordenProductoN1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(9, 9, 9)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(tfPrecioProductoN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(9, 9, 9)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbCategoriaN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addGap(38, 38, 38)
                .addComponent(btnRegistrar)
                .addGap(267, 267, 267))
        );

        jTabbedPane1.addTab("Agregar Nuevo Producto", jPanel2);

        jLabel32.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel32.setText("Productos en Punto de Reorden");

        jLabel20.setText("Productos en Punto de Reorden");

        jBProductosPtoReorden.setText("Generar");
        jBProductosPtoReorden.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBProductosPtoReordenActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelEncabezados8Layout = new javax.swing.GroupLayout(panelEncabezados8);
        panelEncabezados8.setLayout(panelEncabezados8Layout);
        panelEncabezados8Layout.setHorizontalGroup(
            panelEncabezados8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelEncabezados8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelEncabezados8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel20, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel32))
                .addGap(78, 78, 78)
                .addComponent(jBProductosPtoReorden)
                .addGap(24, 24, 24))
        );
        panelEncabezados8Layout.setVerticalGroup(
            panelEncabezados8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelEncabezados8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel32)
                .addGap(15, 15, 15)
                .addGroup(panelEncabezados8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20)
                    .addComponent(jBProductosPtoReorden))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jTablaProductoPtoReorden.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null}
            },
            new String [] {
                "Código", "Nombre", "Descripción"
            }
        ));
        jScrollPane3.setViewportView(jTablaProductoPtoReorden);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelEncabezados8, javax.swing.GroupLayout.DEFAULT_SIZE, 472, Short.MAX_VALUE)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(panelEncabezados8, javax.swing.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(130, 130, 130))
        );

        jTabbedPane1.addTab("Productos en Punto de Reorden", jPanel5);

        jLabel30.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel30.setText("Actualizar Existencias de Productos");

        jlProductoInventario.setText("Producto:");

        jBAceptarAE.setText("Aceptar");
        jBAceptarAE.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBAceptarAEActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelEncabezados6Layout = new javax.swing.GroupLayout(panelEncabezados6);
        panelEncabezados6.setLayout(panelEncabezados6Layout);
        panelEncabezados6Layout.setHorizontalGroup(
            panelEncabezados6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelEncabezados6Layout.createSequentialGroup()
                .addGroup(panelEncabezados6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelEncabezados6Layout.createSequentialGroup()
                        .addGap(40, 40, 40)
                        .addComponent(jLabel30))
                    .addGroup(panelEncabezados6Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jlProductoInventario)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTProductoInventario, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jCCategoriasI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jBAceptarAE)))
                .addContainerGap(108, Short.MAX_VALUE))
        );
        panelEncabezados6Layout.setVerticalGroup(
            panelEncabezados6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelEncabezados6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel30)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)
                .addGroup(panelEncabezados6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlProductoInventario)
                    .addComponent(jTProductoInventario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jCCategoriasI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBAceptarAE)))
        );

        jLabel1.setText("Código:");

        jLabel2.setText("Descripcion:");

        jLabel8.setText("Cantidad:");

        jPanel6.setBackground(new java.awt.Color(102, 102, 102));

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 467, Short.MAX_VALUE)
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 3, Short.MAX_VALUE)
        );

        jLabel10.setText("Precio:");

        jLabel11.setText("Categoría:");

        jLabel12.setText("Unidades que desea agregar:");

        jButton1.setText("jButton1");

        jBActualizarExistencias.setText("Actualizar Existencias");
        jBActualizarExistencias.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBActualizarExistenciasActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelEncabezados6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLCodigoI, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(378, Short.MAX_VALUE))
            .addComponent(jPanel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jLabel8)
                    .addComponent(jLabel10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTDescripcionI, javax.swing.GroupLayout.PREFERRED_SIZE, 249, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jTPrecioI, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jTCantidadI, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE)))
                .addContainerGap(146, Short.MAX_VALUE))
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel11)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTCategoriaI, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(257, Short.MAX_VALUE))
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel12)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTUnidadesParaAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(255, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(201, Short.MAX_VALUE)
                .addComponent(jBActualizarExistencias)
                .addGap(131, 131, 131))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(panelEncabezados6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(8, 8, 8)
                        .addComponent(jLCodigoI)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jTDescripcionI, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(8, 8, 8)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jTCantidadI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel10)
                    .addComponent(jTPrecioI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(21, 21, 21)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel11)
                    .addComponent(jTCategoriaI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(27, 27, 27)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(jTUnidadesParaAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(51, 51, 51)
                .addComponent(jBActualizarExistencias)
                .addGap(210, 210, 210))
        );

        jTabbedPane1.addTab("Actualizar Existencias de Productos", jPanel3);

        jLabel31.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel31.setText("Actualizar Información de Productos");

        jLabel13.setText("Producto:");

        jBBuscarA.setText("Buscar");
        jBBuscarA.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBBuscarAActionPerformed(evt);
            }
        });

        jPanel7.setBackground(new java.awt.Color(102, 102, 102));

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 467, Short.MAX_VALUE)
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 9, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout panelEncabezados7Layout = new javax.swing.GroupLayout(panelEncabezados7);
        panelEncabezados7.setLayout(panelEncabezados7Layout);
        panelEncabezados7Layout.setHorizontalGroup(
            panelEncabezados7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelEncabezados7Layout.createSequentialGroup()
                .addGroup(panelEncabezados7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelEncabezados7Layout.createSequentialGroup()
                        .addGap(37, 37, 37)
                        .addComponent(jLabel31))
                    .addGroup(panelEncabezados7Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel13)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTProductoA, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCCategoriasA, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBBuscarA)))
                .addContainerGap(73, Short.MAX_VALUE))
            .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        panelEncabezados7Layout.setVerticalGroup(
            panelEncabezados7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelEncabezados7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel31)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelEncabezados7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(jTProductoA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jCCategoriasA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBBuscarA))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jLabel14.setText("Código:");

        jLabel15.setText("Descripción:");

        jLabel16.setText("Cantidad:");

        jLabel17.setText("Precio:");

        jLabel18.setText("Categoría:");

        jBActualizarInformacion.setText("Actualizar Información");
        jBActualizarInformacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBActualizarInformacionActionPerformed(evt);
            }
        });

        jLabel19.setText("Nombre:");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelEncabezados7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(132, 132, 132)
                .addComponent(jBActualizarInformacion)
                .addContainerGap(196, Short.MAX_VALUE))
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel16)
                    .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel17)
                    .addComponent(jLabel15)
                    .addComponent(jLabel14)
                    .addComponent(jLabel19))
                .addGap(22, 22, 22)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTCodigoA, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(8, 8, 8)
                        .addComponent(jCCategoriasActualizar, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jTDescripcionA, javax.swing.GroupLayout.PREFERRED_SIZE, 289, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTCantidadA, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTPrecioA, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTNombreProductoActualizar, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(88, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(panelEncabezados7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(jTNombreProductoActualizar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(19, 19, 19)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(jTCodigoA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel15)
                    .addComponent(jTDescripcionA, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(9, 9, 9)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel16)
                    .addComponent(jTCantidadA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(jTPrecioA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jCCategoriasActualizar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel18))
                .addGap(42, 42, 42)
                .addComponent(jBActualizarInformacion)
                .addGap(237, 237, 237))
        );

        jTabbedPane1.addTab("Actualizar Información de Productos", jPanel4);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 773, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 637, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnRegistrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRegistrarActionPerformed
        int resultado = JOptionPane.showConfirmDialog(this, "¿Está seguro de registrar el nuevo producto?");
        if (resultado == JOptionPane.OK_OPTION) {
            ProductoBusiness productoBusiness = new ProductoBusiness(administrador.getNombre(), administrador.getClave());
            Producto producto = new Producto();
            producto.setNombreProducto(tfNombreProductoN.getText());
            producto.setDescripcion(taDescripcionProductoN.getText());
            producto.setPrecio(Float.parseFloat(tfPrecioProductoN.getText()));
            producto.setCantidadInventario(Integer.parseInt(tfCantidadProductoN.getText()));
            producto.setCategoria(categorias.get(cbCategoriaN.getSelectedIndex()));

            try {
                productoBusiness.insertarProductoNuevo(producto);
                DialogMensajes dialogMensaje = new DialogMensajes(null, true, "Éxito", "Producto registrado correctamente");
                dialogMensaje.setVisible(true);
            } catch (SQLException ex) {
                DialogMensajes dialogMensaje = new DialogMensajes(null, true, "Error", ex.getMessage());
                dialogMensaje.setVisible(true);
            }
        }
    }//GEN-LAST:event_btnRegistrarActionPerformed

    private void bBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bBuscarActionPerformed
        // TODO add your handling code here:
        if (bBuscar == evt.getSource()) {
            try {
                ProductoBusiness productoBusiness = new ProductoBusiness(administrador.getNombre(), administrador.getClave());
                LinkedList<Producto> productos = productoBusiness.getProductosPorCategoria(cbCategoriasB.getSelectedIndex() + 1);

                int filas = 0;
                DefaultTableModel modeloTablaProductos = (DefaultTableModel) jTTablaProductos.getModel();

                for (Producto producto : productos) {
                    modeloTablaProductos.addRow(new Object[filas]);
                    jTTablaProductos.setValueAt(producto.getCodProducto(), filas, 0);
                    jTTablaProductos.setValueAt(producto.getNombreProducto(), filas, 1);
                    jTTablaProductos.setValueAt(producto.getDescripcion(), filas, 2);
                    filas++;
                }

            } catch (SQLException ex) {
                ex.printStackTrace();
            }


        }
    }//GEN-LAST:event_bBuscarActionPerformed

    private void jBAceptarAEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBAceptarAEActionPerformed
        if (jBAceptarAE == evt.getSource()) {
            try {
                ProductoBusiness productoBusiness = new ProductoBusiness(administrador.getNombre(), administrador.getClave());
                LinkedList<Producto> productos = productoBusiness.getProductosPorCategoria(jCCategoriasI.getSelectedIndex() + 1);

                boolean encontrado = false;
                int index = 0;
                while (encontrado == false && index < productos.size()) {
                    if (jTProductoInventario.getText().compareToIgnoreCase(productos.get(index).getNombreProducto()) == 0) {
                        jTProductoInventario.setText(productos.get(index).getNombreProducto());
                        jLCodigoI.setText("" + productos.get(index).getCodProducto());
                        jTDescripcionI.setText(productos.get(index).getDescripcion());
                        jTCantidadI.setText("" + productos.get(index).getCantidadInventario());
                        jTPrecioI.setText("" + productos.get(index).getPrecio());
                        jTCategoriaI.setText(productos.get(index).getCategoria().getNombreCategoria());
                        encontrado = true;
                    }
                    index++;
                }


            } catch (SQLException ex) {
            }
        }
    }//GEN-LAST:event_jBAceptarAEActionPerformed

    private void jBActualizarExistenciasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBActualizarExistenciasActionPerformed
        if (jBActualizarExistencias == evt.getSource()) {
            try {
                ProductoBusiness productoBusiness = new ProductoBusiness(administrador.getNombre(), administrador.getClave());
                Producto producto = new Producto();
                producto.setCodProducto(Integer.parseInt(jLCodigoI.getText()));
                producto.setCantidadInventario(Integer.parseInt(jTUnidadesParaAgregar.getText()));
                productoBusiness.agregarProductoExistente(producto);
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
        }
    }//GEN-LAST:event_jBActualizarExistenciasActionPerformed

    private void jBBuscarAActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBBuscarAActionPerformed
        if (jBBuscarA == evt.getSource()) {
            try {
                ProductoBusiness productoBusiness = new ProductoBusiness(administrador.getNombre(), administrador.getClave());
                LinkedList<Producto> productos = productoBusiness.getProductosPorCategoria(jCCategoriasA.getSelectedIndex() + 1);
                boolean encontrado = false;
                int index = 0;
                while (encontrado == false && index < productos.size()) {
                    if (jTProductoA.getText().compareToIgnoreCase(productos.get(index).getNombreProducto()) == 0) {
                        jTNombreProductoActualizar.setText(productos.get(index).getNombreProducto());
                        jTProductoA.setText(productos.get(index).getNombreProducto());
                        jTCodigoA.setText("" + productos.get(index).getCodProducto());
                        jTDescripcionA.setText(productos.get(index).getDescripcion());
                        jTCantidadA.setText("" + productos.get(index).getCantidadInventario());
                        jTPrecioA.setText("" + productos.get(index).getPrecio());
                        jCCategoriasActualizar.setSelectedIndex(jCCategoriasA.getSelectedIndex());
                        encontrado = true;
                    }
                    index++;
                }
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
        }
    }//GEN-LAST:event_jBBuscarAActionPerformed

    private void jBActualizarInformacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBActualizarInformacionActionPerformed
        if (jBActualizarInformacion == evt.getSource()) {
            try {
                Producto producto = new Producto();
                producto.setNombreProducto(jTNombreProductoActualizar.getText());
                producto.setDescripcion(jTDescripcionA.getText());
                producto.setPrecio(Float.parseFloat(jTPrecioA.getText()));
                Categoria categoria = new Categoria();
                categoria.setCodCategoria(jCCategoriasActualizar.getSelectedIndex() + 1);
                producto.setCategoria(categoria);
                producto.setCodProducto(Integer.parseInt(jTCodigoA.getText()));
                ProductoBusiness productoBusiness = new ProductoBusiness(administrador.getNombre(), administrador.getClave());
                productoBusiness.actualizarProducto(producto);
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
        }
    }//GEN-LAST:event_jBActualizarInformacionActionPerformed

    private void jBProductosPtoReordenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBProductosPtoReordenActionPerformed
        try {
            ProductoBusiness productoBusiness = new ProductoBusiness(administrador.getNombre(), administrador.getClave());
            LinkedList<Producto> productos = productoBusiness.getProductoPtoReorden();

            int filas = 0;
            DefaultTableModel modeloTablaProductosReorden = (DefaultTableModel) jTablaProductoPtoReorden.getModel();

            for (Producto producto : productos) {
                modeloTablaProductosReorden.addRow(new Object[filas]);
                jTablaProductoPtoReorden.setValueAt(producto.getCodProducto(), filas, 0);
                jTablaProductoPtoReorden.setValueAt(producto.getNombreProducto(), filas, 1);
                jTablaProductoPtoReorden.setValueAt(producto.getDescripcion(), filas, 2);
                filas++;
            }
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jBProductosPtoReordenActionPerformed
    /**
     * @param args the command line arguments
     */
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bBuscar;
    private javax.swing.JButton btnRegistrar;
    private javax.swing.JComboBox cbCategoriaN;
    private javax.swing.JComboBox cbCategoriasB;
    private javax.swing.JButton jBAceptarAE;
    private javax.swing.JButton jBActualizarExistencias;
    private javax.swing.JButton jBActualizarInformacion;
    private javax.swing.JButton jBBuscarA;
    private javax.swing.JButton jBProductosPtoReorden;
    private javax.swing.JButton jButton1;
    private javax.swing.JComboBox jCCategoriasA;
    private javax.swing.JComboBox jCCategoriasActualizar;
    private javax.swing.JComboBox jCCategoriasI;
    private javax.swing.JLabel jLCodigoI;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTextField jTCantidadA;
    private javax.swing.JTextField jTCantidadI;
    private javax.swing.JTextField jTCategoriaI;
    private javax.swing.JTextField jTCodigoA;
    private javax.swing.JTextField jTDescripcionA;
    private javax.swing.JTextField jTDescripcionI;
    private javax.swing.JTextField jTNombreProductoActualizar;
    private javax.swing.JTextField jTPrecioA;
    private javax.swing.JTextField jTPrecioI;
    private javax.swing.JTextField jTProductoA;
    private javax.swing.JTextField jTProductoInventario;
    private javax.swing.JTable jTTablaProductos;
    private javax.swing.JTextField jTUnidadesParaAgregar;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTablaProductoPtoReorden;
    private javax.swing.JLabel jlProductoInventario;
    private javax.swing.JLabel lblProducto;
    private jam.sfcc.application.PanelEncabezados panelEncabezados4;
    private jam.sfcc.application.PanelEncabezados panelEncabezados5;
    private jam.sfcc.application.PanelEncabezados panelEncabezados6;
    private jam.sfcc.application.PanelEncabezados panelEncabezados7;
    private jam.sfcc.application.PanelEncabezados panelEncabezados8;
    private javax.swing.JTextArea taDescripcionProductoN;
    private javax.swing.JTextField tfCantidadProductoN;
    private javax.swing.JTextField tfNombreProducto;
    private javax.swing.JTextField tfNombreProductoN;
    private javax.swing.JTextField tfPrecioProductoN;
    private javax.swing.JTextField tfPuntoReordenProductoN1;
    // End of variables declaration//GEN-END:variables
}
